package com.bjesc_b2c.app.appraiset.adapter;

import android.content.Context;

import com.bjesc_b2c.app.appraiset.R;

import java.util.List;

import app.pinggushi.bjesc.com.baserecyclerview.adapter.CommonAdapter;
import app.pinggushi.bjesc.com.baserecyclerview.adapter.base.ViewHolder;
import master_bean.CountryVariousCityBean;

/**
 * Created by Jason Chen on 2017/2/22.
 */

public class ProvinceAdapter extends CommonAdapter<CountryVariousCityBean> {
    public ProvinceAdapter(Context context, int layoutId, List<CountryVariousCityBean> datas) {
        super(context, layoutId, datas);
    }

    @Override
    protected void convertView(ViewHolder holder, CountryVariousCityBean bean, int position) {

        if (position != 0) {
            if (mDatas.get(position).getFirstletter().equals(mDatas.get(position - 1).getFirstletter())) {
                holder.setVisible(R.id.tv_letter, false);
            } else {
                holder.setText(R.id.tv_letter, bean.getFirstletter());
                holder.setVisible(R.id.tv_letter, true);
            }
        } else {
            holder.setText(R.id.tv_letter, bean.getFirstletter());
            holder.setVisible(R.id.tv_letter, true);
        }
        holder.setText(R.id.tv_city_name, bean.getProvince());
        if (position + 1 < mDatas.size()) {
            if (bean.getFirstletter().equals(mDatas.get(position + 1).getFirstletter())) {

            } else {

            }
        }
        if (bean.isCheck()) {
            holder.setTextColorRes(R.id.tv_city_name, R.color.colorFFFF7900);
        } else {
            holder.setTextColorRes(R.id.tv_city_name, R.color.colorFF030303);
        }
    }
}
